﻿using FS_Service;
using FS_Unitys.Basic;
using FS_Unitys.Log;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace FS_Webservice
{
    /// <summary>
    /// TD_WebService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class TD_WebService : System.Web.Services.WebService
    {
        private static readonly LogHelper LogHelper = new LogHelper(typeof(TD_WebService));
        private FSService fSService = new FSService();

        [WebMethod]
        public string ReadNetWorkToAbsolute()
        {
            ResultInfo res = fSService.ReadNetWorkToAbsolute();
            return JsonXmlUtils.SerializeObject(res);
        }


        /// <summary>
        /// 从前置机读取，到内部写入
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public string WriteNetWorkPath(string resJson)
        {
            ResultInfo res = fSService.WriteNetWorkPath(resJson);
            return JsonXmlUtils.SerializeObject(res);
        }

        [WebMethod]
        public string ReNameNetWork(string json)
        {
            // 修改
           // LogHelper.Info($"ReName:{json}");
            List<string> list = JsonXmlUtils.DeserializeObject<List<string>>(json);
            ResultInfo res = fSService.RenameFileNameSuffix(list, true);
            return JsonXmlUtils.SerializeObject(res);
        }
    }
}
